package com.tempjob.common.businesss.mongo.entity;

import com.anwen.mongo.annotation.ID;
import com.anwen.mongo.annotation.collection.CollectionField;
import com.anwen.mongo.annotation.collection.CollectionName;
import com.anwen.mongo.enums.FieldFill;
import com.anwen.mongo.enums.IdTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Version;

import java.io.Serializable;
import java.util.Date;

/**
 * 系统权限
 * @TableName sys_permission
 */
@CollectionName(value ="sys_permission")
@Data
public class SysPermission implements Serializable {

    @ID(type = IdTypeEnum.OBJECT_ID)
    @CollectionField("_id")
    private String id;

    @CollectionField(value = "pid")
    @ApiModelProperty("父级菜单权限名称")
    private String pid;

    @CollectionField(exist = false)
    private String pidName;

    @CollectionField(value = "name")
    @ApiModelProperty("菜单权限名称")
    private String name;

    @CollectionField(value = "path")
    @ApiModelProperty("path")
    private String path;

    @CollectionField(value = "component")
    @ApiModelProperty("组件")
    private String component;

    @CollectionField(value = "title")
    @ApiModelProperty("标题")
    private String title;

    @CollectionField(value = "hidden")
    @ApiModelProperty("隐藏")
    private Boolean hidden;

    @CollectionField(value = "perms")
    @ApiModelProperty("授权(多个用逗号分隔，如：sys:user:add,sys:user:edit)")
    private String perms;

    @CollectionField(value = "target")
    @ApiModelProperty("")
    private String target;

    @CollectionField(value = "icon")
    @ApiModelProperty("图标")
    private String icon;

    @CollectionField(value = "redirect")
    @ApiModelProperty("访问地址URL")
    private String redirect;

    @CollectionField(value = "rank")
    @ApiModelProperty("排序")
    private Integer rank;

    @CollectionField(value = "type")
    @ApiModelProperty("菜单权限类型(1:目录;2:菜单;3:按钮)")
    private Integer type;

    @CollectionField(value = "status")
    @ApiModelProperty("状态1:正常 0：禁用")
    private Integer status;

    @CollectionField(value = "oper_time",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间",hidden = true)
    private Date operTime;

    @CollectionField(value = "oper_id",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人id",hidden = true)
    private Long operId;

    @CollectionField(value = "oper_name",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人",hidden = true)
    private String operName;

    @CollectionField(value = "create_id",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人id",hidden = true)
    private Long createId;

    @CollectionField(value = "create_name",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人",hidden = true)
    private String createName;

    @CollectionField(value = "create_time",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间",hidden = true)
    private Date createTime;

    @Version
    @CollectionField("version")
    @ApiModelProperty(value = "乐观锁", hidden = true)
    private Integer version;

    @CollectionField(exist = false)
    private static final long serialVersionUID = 1L;
}
